<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title></title>
	</head>
	<body>
		<form action="" method="">
			<table border="1" cellspacing="0" cellpadding="20px;" id="tableId">
				<tr>
					<th></th>
					<th>姓名</th>
					<th>性别</th>
					<th>年龄</th>
					<th>家庭住址</th>
				</tr>
				<tr>
					<td><input type="checkbox" name="man" id="" value="" /></td>
					<td>张三</td>
					<td>男</td>
					<td>19</td>
					<td>福建省</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="woman" id="" value="" /></td>
					<td>张三2</td>
					<td>女</td>
					<td>19</td>
					<td>福建省</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="woman" id="" value="" /></td>
					<td>张三3</td>
					<td>女</td>
					<td>19</td>
					<td>福建省</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="man" id="" value="" /></td>
					<td>张三4</td>
					<td>男</td>
					<td>19</td>
					<td>福建省</td>
				</tr>
				<tr>
					<td><input type="checkbox" name="man" id="" value="" /></td>
					<td>张三5</td>
					<td>男</td>
					<td>19</td>
					<td>福建省</td>
				</tr>
			</table>
			<input type="checkbox" name="" id="quanxuan" value="" / onclick="danji();">全选
			<input type="checkbox" name="" id="nan" value="" / onclick="mans();">全选男
			<input type="checkbox" name="" id="nv" value="" / onclick="womans();">全选女
			<button type="submit">删除</button>
		</form>
	</body>
	<script type="text/javascript">
	function danji()
	{
		var tableid=document.getElementById('tableId');
		var alltabletr=tableid.getElementsByTagName('input');
		console.log(alltabletr)
		var overin=document.getElementById('quanxuan');
		for(var i=0;i<alltabletr.length;i++)
		{
			alltabletr[i].checked=overin.checked;
		}
	}
	function mans()
	{
		var allman=document.getElementsByName('man')
		console.log(allman)
		var overmans=document.getElementById('nan')
		for(var i=0;i<allman.length;i++)
		{
			allman[i].checked=overmans.checked;
		}
	}
	function womans()
	{
		var allwoman =document.getElementsByName('woman')
		var overwomans=document.getElementById('nv')
		for(var i=0;i<allwoman.length;i++)
		{
			allwoman[i].checked=overwomans.checked;
		}
	}
		
	</script>
</html>
